<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>所有数据</title>
</head>
<body>

<script src="vue.js"></script>
<script src="axios-0.18.0.js"> </script>

<div id="app">
<a href="add.html">添加</a><br>
<table border="1" cellspacing="0" width="800">
<tr>
<th>序号</th>
<th>品牌名称</th>
<th>企业名称</th>
<th>排序</th>
<th>品牌介绍</th>
<th>状态</th>
<th>操作</th>
</tr>

<tr  v-for="(brand,i) in brands"   align="center">
<td>{{brand.id}}</td>
<td>{{brand.brandName}}</td>
<td>{{brand.companyName}}</td>
<td>{{brand.ordered}}</td>
<td>{{brand.xinxi}}</td>
<td>{{brand.statusStr}}</td>
<td><a href="update.html"><input type="button" value="更改"></a>
<input type="button"  @click="submitDelete(brand.id)" value="删除"></td><br>
</tr>
</table>
</div>

<a href=/Web/userRizhiAdd>保存当前登录信息并显示所有登录信息</a><br>
<a href=/Web/userUpdate.jsp>更改密码</a><br>
<a href=/Web/userOut>退出登录</a>

<script>
new Vue({
	el:"#app",
	data(){
		return{
			brands:[],
		}
	},
	methods:{
		 submitDelete(e){
		 	   axios({
				   method:"get",
				   url:"http://localhost:8080/Web/brand/Delete?id="+e,
			   }).then(resp=>{
				   if(resp.data=="success"){
					 location.href="http://localhost:8080/Web/brand.html";
				   }
			   }) 
		   }
	   },
	mounted(){
		//页面加载完成后 发送异步请求 查询数据
		axios({
			method:"get",
			url:"http://localhost:8080/Web/brand/SelectAll"
		}).then(resp=>{
			this.brands=resp.data;
		})
	},
})
</script>
</body>
</html>